import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BluetoothVersionVO, BluetoothVersionForm, BluetoothVersionQuery } from '@/api/device/bluetoothVersion/types';

/**
 * 查询蓝牙升级信息列表
 * @param query
 * @returns {*}
 */

export const listBluetoothVersion = (query?: BluetoothVersionQuery): AxiosPromise<BluetoothVersionVO[]> => {
  return request({
    url: '/device/bluetoothVersion/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询蓝牙升级信息详细
 * @param bluetoothVersionId
 */
export const getBluetoothVersion = (bluetoothVersionId: string | number): AxiosPromise<BluetoothVersionVO> => {
  return request({
    url: '/device/bluetoothVersion/' + bluetoothVersionId,
    method: 'get'
  });
};

/**
 * 新增蓝牙升级信息
 * @param data
 */
export const addBluetoothVersion = (data: BluetoothVersionForm) => {
  return request({
    url: '/device/bluetoothVersion',
    method: 'post',
    data: data
  });
};

/**
 * 修改蓝牙升级信息
 * @param data
 */
export const updateBluetoothVersion = (data: BluetoothVersionForm) => {
  return request({
    url: '/device/bluetoothVersion',
    method: 'put',
    data: data
  });
};

/**
 * 删除蓝牙升级信息
 * @param bluetoothVersionId
 */
export const delBluetoothVersion = (bluetoothVersionId: string | number | Array<string | number>) => {
  return request({
    url: '/device/bluetoothVersion/' + bluetoothVersionId,
    method: 'delete'
  });
};
